package cn.itcast.controller;

import cn.itcast.pojo.Emp;
import cn.itcast.pojo.LoginInfo;
import cn.itcast.pojo.Result;
import cn.itcast.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/login")
public class LoginController {
    @Autowired
    private EmpService empService;

    @PostMapping
    public Result login(@RequestBody Emp emp){
        LoginInfo loginInfo= empService.login(emp);
        return Result.success(loginInfo);
    }
}
